package tirateima;

import org.jgraph.graph.DefaultCellViewFactory;
import org.jgraph.graph.VertexView;

import com.jgraph.components.labels.CellConstants;
import com.jgraph.components.labels.MultiLineVertexRenderer;
import com.jgraph.components.labels.MultiLineVertexView;

/**
 * Fabrica de view para o uso do MultiLineVertexView que possui mais formatos de vertices.
 *
 */
public class MultiLineVertexViewFactory extends DefaultCellViewFactory {

	int tipo;
	
	/**
	 * Cria uma view para que os vertices sejam circulos.
	 */
	@Override
	protected VertexView createVertexView(Object cell) {
		MultiLineVertexView vertexView = new MultiLineVertexView(cell);
		CellConstants.setVertexShape(vertexView.getAttributes(), tipo);
		return vertexView;
	}
	
	public MultiLineVertexViewFactory() {
		tipo = MultiLineVertexRenderer.SHAPE_CIRCLE;
	}
	
	public MultiLineVertexViewFactory(int tipo) {
		this.tipo = tipo;
	}
	
}
